<script setup lang="ts">
import { useSound } from '@vueuse/sound'
import { sleep } from '@/utils/sleep'
import stepImg20 from '@/assets/common/12/step_01_3.jpg'
import stepImg20_1 from '@/assets/common/12/step_02_0.jpg'
import stepImg21 from '@/assets/common/12/step_02_1.jpg'

import correctAnswerSfx from '@/assets/sound/correct_answer.mp3'

const { play } = useSound(correctAnswerSfx)
const currentStepImg = ref(stepImg20)

const intro = useIntro({
  steps: [],
}, [])

const appStore = useAppStore()

const router = useRouter()

const secendBar = [

  {
    icon: 'new_add',
    label: '新增画中画',
    callBack: () => { },
  },

]
const isUnmounted = ref(false); // 控制是否打断跳转
intro.stop()
appStore.setGlobalTip('step_12_2', 'encourage_2')
const set1 = setTimeout(async () => {
  if (!isUnmounted.value) {
    router.push('Mask5_2');
  }
}, 5000);

onBeforeUnmount(() => {
  intro.stop()
  isUnmounted.value = true;
  console.log('Mask5_1 组件实例被卸载之前调用')
  clearTimeout(set1)
  appStore.setGlobalTip("","")
})
onUnmounted(() => {
  intro.stop()
  isUnmounted.value = true;
  console.log('Mask5_1 组件实例被卸载之前调用')
  clearTimeout(set1)
  appStore.setGlobalTip("","")
})
</script>

<template>
  <div class="flex-1 flex flex-col">
    <div class="yesclick no-click "></div>
    <div class="flex justify-between h-4em p-x-1em pt-1em ">
      <div>
        <i class="i-material-symbols-close mr-1em" />
        <i class="i-material-symbols-help-outline" />
      </div>

      <div>
        <n-button type="info" size="small" class="mr-1em">
          1080P<i class="i-material-symbols-arrow-drop-down-rounded" />
        </n-button>
        <n-button id="exportBtn" type="primary" size="small">
          导出
        </n-button>
      </div>
    </div>

    <div class="bg-#0A0A0A ">
      <img :src="currentStepImg" class="w-full" style="height: 90%;">
    </div>

    <div class="flex h-4em items-center bg-#1C1C1C" style="position: absolute; bottom: 3px;width: 100%;height: ;">
      <div class="bg-#333 h-70% rounded flex-center m-x-0.5em">
        <i class="i-icon-park-outline-left" />
      </div>

      <div class="flex flex-1 overflow-x-auto scrollbar-none  ">
        <div v-for="item in secendBar" :id="item.icon" :key="item.label" class="flex-col-center flex-1 min-w-16%"
          @click.stop="item.callBack">
          <png-icon :icon="item.icon" class="text-2em m-b-3px" />
          <div class="text-sm">
            {{ item.label }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<style scoped lang="scss">
.no-click {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  z-index: 99;
}
</style>